from public.tools import *
from public.action import *
from public.testDATE import *

from selenium.webdriver.common.keys import Keys
testCase="DBshop019_属性分组添加属性"
SX="好好学习"
MC="天天向上"
firefox=openB(adminurl)
adminlogin(firefox)
menuu3(firefox,"商品管理","商品属性","属性")
# "1.点击“添加属性”按钮，编写属性分组“好好学习”，属性类型“下拉”，属性名称“天天向上”，排序“255”。
firefox.find_element_by_partial_link_text("添加属性").click()
s=Select(firefox.find_element_by_id("attribute_group_id"))
s.select_by_visible_text(SX)
firefox.find_element_by_id("attribute_name").send_keys(MC)
# 2.点击“保存属性信息”按钮，保存成功。"
firefox.find_element_by_xpath("//button").click()

#断言

try:
    firefox.find_element_by_xpath("//tr/td[text()='%s']" % MC)
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()